import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";

export const userSlice = createSlice({
  name: "user",
  initialState: {
    userInfo: {},
    permissionBtns: [],
  },
  reducers: {
    // 获取用户信息
    setUserInfo(state, { payload }) {
      state.userInfo = payload;
    },
    // 按钮权限码
    setStoragePermissionBtns(state, { payload }) {
      state.permissionBtns = payload;
    },
  },
});

export const { setStoragePermissionBtns, setUserInfo } = userSlice.actions;

export default userSlice.reducer;
